
package com.mjlf.cloud.configclient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther a123
 * @create 2018-02-28 11:53
 * @desc
 */
@RefreshScope
@RestController
public class TestConfigClientController {

    @Value("${from}")
    private String from;

    @Autowired
    private org.springframework.core.env.Environment env;

    @RequestMapping(value = "/from", method = RequestMethod.GET)
    public String from(){
        return this.from;
    }

    @RequestMapping(value = "/from1", method = RequestMethod.GET)
    public String from1(){
        return this.env.getProperty("from", "default");
    }
}
